/**
 * 创建角色DTO
 * 作者：GodMainCode
 * 创建时间：2024-01-17
 * 修改时间：2024-01-17
 * 修改人：GodMainCode
 */

import { IsString, IsInt, IsOptional, Min, IsArray } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateRoleDto {
  @ApiProperty({ description: '角色名称', example: '管理员' })
  @IsString()
  name: string;

  @ApiProperty({ description: '角色标识', example: 'admin' })
  @IsString()
  code: string;

  @ApiProperty({ description: '角色描述', required: false, example: '系统管理员' })
  @IsString()
  @IsOptional()
  description?: string;

  @ApiProperty({ description: '排序', required: false, default: 0 })
  @IsInt()
  @Min(0)
  @IsOptional()
  sort?: number;

  @ApiProperty({ description: '权限ID列表', type: [Number], example: [1, 2, 3] })
  @IsArray()
  @IsInt({ each: true })
  permissionIds: number[];
} 